//
//  SchemeListTableViewCell.m
//  PlayBall
//
//  Created by yanxun on 8/22/14.
//
//

#import "SchemeListTableViewCell.h"

@interface SchemeListTableViewCell (){
    UILabel *_lotteryID;
    UILabel *_issueName;
    UILabel *_money;
    UILabel *_buyEndTime;
    UILabel *_isOverdue;
    UIImageView *_picHead;
}

@end

@implementation SchemeListTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        _lotteryID = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 84.5f, 15)];
        _lotteryID.backgroundColor = [UIColor clearColor];
        //_lotteryID.font = [UIFont systemFontOfSize:15.0f];
        _lotteryID.font = [UIFont boldSystemFontOfSize:15.0f];
        
        _lotteryID.textAlignment = NSTextAlignmentCenter;
        
        [self.contentView addSubview:_lotteryID];
        
        _issueName = [[UILabel alloc] initWithFrame:CGRectMake(91, 10, 90, 13)];
        _issueName.backgroundColor = [UIColor clearColor];
        _issueName.font = [UIFont systemFontOfSize:13.0f];
        _issueName.textColor = [UIColor colorWithRed:105.0f/255.0f green:105.0f/255.0f blue:105.0f/255.0f alpha:1.0f];
        [self.contentView addSubview:_issueName];
        
        _money = [[UILabel alloc] initWithFrame:CGRectMake(91, 36, 120, 13)];
        _money.backgroundColor = [UIColor clearColor];
        _money.textColor = [UIColor colorWithRed:105.0f/255.0f green:105.0f/255.0f blue:105.0f/255.0f alpha:1.0f];
        _money.font = [UIFont systemFontOfSize:13.0f];
        [self.contentView addSubview:_money];
        
        _buyEndTime = [[UILabel alloc] initWithFrame:CGRectMake(91, 60, 200, 13)];
        _buyEndTime.backgroundColor = [UIColor clearColor];
        _buyEndTime.textColor = [UIColor colorWithRed:105.0f/255.0f green:105.0f/255.0f blue:105.0f/255.0f alpha:1.0f];
        _buyEndTime.font = [UIFont systemFontOfSize:13.0f];
        [self.contentView addSubview:_buyEndTime];
        
        _isOverdue = [[UILabel alloc] initWithFrame:CGRectMake(216, 10, 42, 13)];
        _isOverdue.backgroundColor = [UIColor clearColor];
        _isOverdue.textColor = [UIColor colorWithRed:105.0f/255.0f green:105.0f/255.0f blue:105.0f/255.0f alpha:1.0f];
        _isOverdue.font = [UIFont systemFontOfSize:13.0f];
        [self.contentView addSubview:_isOverdue];
        
        _picHead = [[UIImageView alloc] initWithFrame:CGRectMake(15, 30, 54.5, 54.5)];
        _picHead.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:_picHead];
        
    }
    return self;
}

//
- (void)setPropertyInfo:(NSDictionary *)infoDic{
    _lotteryID.text = [NSString stringWithFormat:@"%@",[infoDic objectForKey:@"LotteryID"]];
    _issueName.text = [NSString stringWithFormat:@"第%@期",[infoDic objectForKey:@"IssueName"]];
    _money.text = [NSString stringWithFormat:@"%@彩豆",[infoDic objectForKey:@"Money"]];
    _buyEndTime.text = [NSString stringWithFormat:@"截止时间:%@",[infoDic objectForKey:@"BuyEndTime"]];
    if (0 == [[infoDic objectForKey:@"IsOverdue"] integerValue]) {
        _isOverdue.text = [NSString stringWithFormat:@"待发起"];
    }else{
        _isOverdue.text = [NSString stringWithFormat:@"已过期"];
    }
    
    if ([@"竞彩足球" isEqualToString:[infoDic objectForKey:@"LotteryID"]]) {
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_jc.png"]];
    }else if ([@"双色球" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage   imageNamed:@"jdd_buy_main_ssq.png"]];
    }else if ([@"超级大乐透" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_dlt.png"]];
    }else if ([@"十一运夺金" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_11ydj"]];
    }else if ([@"11选5" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_11five.png"]];
    }else if ([@"重庆时时彩" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_ssc"]];
    }else if ([@"福彩3D" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_3d.png"]];
    }else if ([@"排列3" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_p3.png"]];
    }else if ([@"排列5" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_p5.png"]];
    }else if ([@"七星彩" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_n7x.png"]];
    }else if ([@"七乐彩" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_n7l.png"]];
    }else if ([@"北京单场" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_bd.png"]];
    }else if ([@"竞彩篮球" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_jclq.png"]];
    }else if ([@"胜负彩" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_sfc.png"]];
    }else if ([@"任选九" isEqualToString:[infoDic objectForKey:@"LotteryID"]]){
        [_picHead setImage:[UIImage imageNamed:@"jdd_buy_main_rx9.png"]];
    }else{
        
    }
    //
    CGRect selfRect = self.frame;
    selfRect.origin.x = 0.0f;
    selfRect.size.height = 90.0f;
    selfRect.size.width = 320.0f;
    self.frame = selfRect;
}


- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
